package tq.com.tqteacher.view.viewhold;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import tq.com.tqcom.util.TQSystemDefine;
import tq.com.tqteacher.R;
import tq.com.tqteacher.model.TQNewPublish;
import tq.com.tqteacher.model.TQWKPublish;
import tq.com.tqteacher.view.TQHShowView;
import tq.com.tqteacher.view.TQVShowView;

public class TQPublishResultViewHelper {
    private View mParent;
    private TQHShowView mTitle0;
    private TQVShowView mDesc;

    private TQHShowView mGrade;
    private TQHShowView mPrice;

    private LinearLayout mWhocanseeTop;
    private TextView mWhocansee;

    private TextView mModeify;

    private TQNewPublish mNewPublish;
    public TQPublishResultViewHelper(View pView){
        mParent = pView;

        if(mParent == null) return;

        mTitle0 = mParent.findViewById(R.id.title0);
        mDesc = mParent.findViewById(R.id.desc);
        mGrade = mParent.findViewById(R.id.grad);
        mPrice = mParent.findViewById(R.id.price);

        mWhocanseeTop = mParent.findViewById(R.id.top);
        mWhocansee = mParent.findViewById(R.id.content1);

        mModeify = mParent.findViewById(R.id.modify);
        mModeify.setText("修改内容");

        mPrice.setVisibility(View.GONE);
    }


    public void setTWDYResult(TQNewPublish pTWDYResult){
        mNewPublish = pTWDYResult;
        if(mNewPublish == null) return;

        mTitle0.setText(pTWDYResult.getName());
        mDesc.setText(pTWDYResult.getDesc());
        mGrade.setText(TQSystemDefine.gradeName(pTWDYResult.getGrade()));

        mWhocanseeTop.setVisibility(View.GONE);
    }

    public void setTBResult(TQNewPublish pTWDYResult){
        mNewPublish = pTWDYResult;
        if(mNewPublish == null)return;

        mTitle0.setText(pTWDYResult.getName());
        mDesc.setText(pTWDYResult.getDesc());
        mGrade.setText(TQSystemDefine.gradeName(pTWDYResult.getGrade()));

        int whocansee = pTWDYResult.getShow();
        mWhocansee.setText(TQSystemDefine.showFanweiTitle(whocansee));
    }

    public void setWkResult(TQWKPublish pWkResult){
        mDesc.setVisibility(View.GONE);

        mNewPublish = pWkResult;
        if(pWkResult == null) return;

        mTitle0.setText(pWkResult.getName());
        mGrade.setText(TQSystemDefine.gradeName(pWkResult.getGrade()));

        int whocansee = pWkResult.getShow();
        mWhocansee.setText(TQSystemDefine.showFanweiTitle(whocansee));
    }

    public void setModifyClick(View.OnClickListener pOnClickListener){
        mModeify.setOnClickListener(pOnClickListener);
    }
}
